<?php
class album_edit extends SClass {

    public function process() {
         try {
            $post = ServiceUtils::GetFactory()->getGalleryService()->getAlbumByID(
                $this->getArgument('id'));
            if ($this->getControlValue('ok')) {
            	ServiceUtils::GetFactory()->getGalleryService()->editAlbum(
            	   $post->getId(),
            	   $this->getControlValue('title'),
            	   $this->getControlValue('comment')
            	);
            	$this->assign('message', 'ok');
            	$this->assign('urlredirect',
            	Engine_LinkMaker::GetURLByContentID('galery_view',
            	   $post->getId()));
            } else {
                $this->setControlValue('title', $post->getTitle());
                $this->setControlValue('comment', $post->getComment());
            }
        } catch (ServiceUtils_Exception $e) {
            $this->assign('errors', $e->getErrors());
        }
    }

}